#!/usr/bin/env bash

if [[ -z $1 ]];then
    echo "usage bash ${0} {PROFILE}"
fi

OUTPUT_PATH="output_scm"

mvn clean package -U -DskipTests -P $1
if [[ -d ${OUTPUT_PATH} ]];then
    rm -rf ${OUTPUT_PATH}
fi

mkdir ${OUTPUT_PATH}

cp search-web/target/*.tar.gz ./${OUTPUT_PATH}
#cp search-batch/target/*.tar.gz ./${OUTPUT_PATH}

cd ${OUTPUT_PATH}
md5sum search-cloud-light-web.tar.gz > searchcloud-light-web.tar.gz.md5
#md5sum search-cloud-batch.tar.gz > search-cloud-batch.tar.gz.md5

### 兼容output
cd ..
if [[ -d output ]];then
    rm -rf output
fi
cp -r ${OUTPUT_PATH} output